﻿using AutoMapper;
using Enferno.Public.Web.Mappers.Resolvers;
using Enferno.Public.Web.Models;
using Enferno.Public.Web.ViewModels;
using Enferno.StormApiClient.Products;

namespace Enferno.Public.Web.Mappers.ProductProfiles
{
    public class ProductFileModelToFileViewModelProfile :
        ProductFileBaseModelToFileBaseViewModelProfile<ProductFileModel, FileViewModel>
    {
        
    }

    public class ProductFileBaseModelToFileBaseViewModelProfile<TProductFileModel, TFileViewModel> : Profile
        where TProductFileModel: ProductFileModel
        where TFileViewModel: FileViewModel
    {
        protected override void Configure()
        {
            Mapper.CreateMap<TProductFileModel, TFileViewModel>()
                .ForMember(to => to.Type, opts => opts.MapFrom(from => from.Type));
        }

        public override string ProfileName
        {
            get { return GetType().Name; }
        }
    }
}
